<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>将数组的内部指针指向最后一个单元</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.end" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">end</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">end</span> &mdash; <span class="dc-title">
     将数组的内部指针指向最后一个单元
    </span></p>

   </div>
 <div class="refsect1 description" id="refsect1-function.end-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>end</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$array</code></span>
   ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>end()</strong></span> 将 <code class="parameter">array</code>
     的内部指针移动到最后一个单元并返回其值。
    </p>
   </div>

    <div class="refsect1 parameters" id="refsect1-function.end-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">array</code></dt>

     <dd>

      <p class="para">
       这个数组。
       该数组是通过引用传递的，因为它会被这个函数修改。
       这意味着你必须传入一个真正的变量，而不是函数返回的数组，因为只有真正的变量才能以引用传递。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.end-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回最后一个元素的值，或者如果是空数组则返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.end-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-6095">
    <p><strong>Example #1 <span class="function"><strong>end()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$fruits&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'apple'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'banana'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'cranberry'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">end</span><span style="color: #007700">(</span><span style="color: #0000BB">$fruits</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;cranberry<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.end-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="current.html" class="function" rel="rdfs-seeAlso">current()</a> - 返回数组中的当前单元</span></li>
    <li class="member"><span class="function"><a href="each.html" class="function" rel="rdfs-seeAlso">each()</a> - 返回数组中当前的键／值对并将数组指针向前移动一步</span></li>
    <li class="member"><span class="function"><a href="prev.html" class="function" rel="rdfs-seeAlso">prev()</a> - 将数组的内部指针倒回一位</span></li>
    <li class="member"><span class="function"><a href="reset.html" class="function" rel="rdfs-seeAlso">reset()</a> - 将数组的内部指针指向第一个单元</span></li>
    <li class="member"><span class="function"><a href="next.html" class="function" rel="rdfs-seeAlso">next()</a> - 将数组中的内部指针向前移动一位</span></li>
   </ul>
  </p>
 </div>

  </div></div></div></body></html>